
package cn.edu.scau.cmi.hombio.service;

import cn.edu.scau.cmi.hombio.domain.FeedTaskQuality;
import cn.edu.scau.cmi.hombio.domain.FodderType;
import cn.edu.scau.cmi.hombio.domain.TaskPigsty;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/pigRs-security-context.xml",
		"file:./resources/pigRs-service-context.xml",
		"file:./resources/pigRs-dao-context.xml",
		"file:./resources/pigRs-web-context.xml" })
@Transactional
public class FeedTaskQualityServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected FeedTaskQualityService service;

	/**
	 * Instantiates a new FeedTaskQualityServiceTest.
	 *
	 */
	public FeedTaskQualityServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findFeedTaskQualityByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findFeedTaskQualityByPrimaryKey 
		Integer id = 0;
		FeedTaskQuality response = null;
		response = service.findFeedTaskQualityByPrimaryKey(id);
		// TODO: JUnit - Add assertions to test outputs of operation: findFeedTaskQualityByPrimaryKey
	}

	/**
	 * Operation Unit Test
	* Save an existing TaskPigsty entity
	* 
	 */
	@Test
	public void saveFeedTaskQualityTaskPigsty() {
		// TODO: JUnit - Populate test inputs for operation: saveFeedTaskQualityTaskPigsty 
		Integer id_1 = 0;
		TaskPigsty related_taskpigsty = new cn.edu.scau.cmi.hombio.domain.TaskPigsty();
		FeedTaskQuality response = null;
		response = service.saveFeedTaskQualityTaskPigsty(id_1, related_taskpigsty);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFeedTaskQualityTaskPigsty
	}

	/**
	 * Operation Unit Test
	* Delete an existing TaskPigsty entity
	* 
	 */
	@Test
	public void deleteFeedTaskQualityTaskPigsty() {
		// TODO: JUnit - Populate test inputs for operation: deleteFeedTaskQualityTaskPigsty 
		Integer feedtaskquality_id = 0;
		Integer related_taskpigsty_id = 0;
		FeedTaskQuality response = null;
		response = service.deleteFeedTaskQualityTaskPigsty(feedtaskquality_id, related_taskpigsty_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFeedTaskQualityTaskPigsty
	}

	/**
	 * Operation Unit Test
	* Save an existing FodderType entity
	* 
	 */
	@Test
	public void saveFeedTaskQualityFodderType() {
		// TODO: JUnit - Populate test inputs for operation: saveFeedTaskQualityFodderType 
		Integer id_2 = 0;
		FodderType related_foddertype = new cn.edu.scau.cmi.hombio.domain.FodderType();
		FeedTaskQuality response = null;
		response = service.saveFeedTaskQualityFodderType(id_2, related_foddertype);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFeedTaskQualityFodderType
	}

	/**
	 * Operation Unit Test
	* Load an existing FeedTaskQuality entity
	* 
	 */
	@Test
	public void loadFeedTaskQualitys() {
		Set<FeedTaskQuality> response = null;
		response = service.loadFeedTaskQualitys();
		// TODO: JUnit - Add assertions to test outputs of operation: loadFeedTaskQualitys
	}

	/**
	 * Operation Unit Test
	* Return a count of all FeedTaskQuality entity
	* 
	 */
	@Test
	public void countFeedTaskQualitys() {
		Integer response = null;
		response = service.countFeedTaskQualitys();
		// TODO: JUnit - Add assertions to test outputs of operation: countFeedTaskQualitys
	}

	/**
	 * Operation Unit Test
	* Save an existing FeedTaskQuality entity
	* 
	 */
	@Test
	public void saveFeedTaskQuality() {
		// TODO: JUnit - Populate test inputs for operation: saveFeedTaskQuality 
		FeedTaskQuality feedtaskquality = new cn.edu.scau.cmi.hombio.domain.FeedTaskQuality();
		service.saveFeedTaskQuality(feedtaskquality);
	}

	/**
	 * Operation Unit Test
	* Return all FeedTaskQuality entity
	* 
	 */
	@Test
	public void findAllFeedTaskQualitys() {
		// TODO: JUnit - Populate test inputs for operation: findAllFeedTaskQualitys 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<FeedTaskQuality> response = null;
		response = service.findAllFeedTaskQualitys(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllFeedTaskQualitys
	}

	/**
	 * Operation Unit Test
	* Delete an existing FodderType entity
	* 
	 */
	@Test
	public void deleteFeedTaskQualityFodderType() {
		// TODO: JUnit - Populate test inputs for operation: deleteFeedTaskQualityFodderType 
		Integer feedtaskquality_id_1 = 0;
		Integer related_foddertype_id = 0;
		FeedTaskQuality response = null;
		response = service.deleteFeedTaskQualityFodderType(feedtaskquality_id_1, related_foddertype_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFeedTaskQualityFodderType
	}

	/**
	 * Operation Unit Test
	* Delete an existing FeedTaskQuality entity
	* 
	 */
	@Test
	public void deleteFeedTaskQuality() {
		// TODO: JUnit - Populate test inputs for operation: deleteFeedTaskQuality 
		FeedTaskQuality feedtaskquality_1 = new cn.edu.scau.cmi.hombio.domain.FeedTaskQuality();
		service.deleteFeedTaskQuality(feedtaskquality_1);
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
